package dao

import (
	"context"
	"sale-admin/internal/dal"
	"sale-admin/internal/models"
)

type GoodsCornerLabel struct{}

// List 商品脚标列表
func (GoodsCornerLabel) List(
	ctx context.Context,
	query *dal.Query,
	merchantID string, // 暂未使用
	labelName string,
	page, limit int,
) ([]*models.MaGoodsCornerLabel, error) {
	cl := dal.MaGoodsCornerLabel
	tx := cl.WithContext(ctx)
	if labelName != "" {
		tx = tx.Where(cl.Name.Like("%" + labelName + "%"))
	}
	return tx.Offset(GetPageOffset(page, limit)).Limit(GetPageLimit(limit)).Find()
}
